package projectServlet;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import dao.DAOException;
import dao.mysql.EmployeeDAOImpl;
import dto.UserDTO;



@WebServlet("/loadalluser")
public class loadalluser extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet  {
	private static final long serialVersionUID = 1L;
       
    public loadalluser() {
        super();
        
    }
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
	}
	
	private void processRequest(HttpServletRequest request, HttpServletResponse response) {
		EmployeeDAOImpl admin = new EmployeeDAOImpl();
		ArrayList<UserDTO> edituser;
		try {
			edituser = admin.findAllUser();
			request.setAttribute("edit", edituser);
		} catch (DAOException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		
		RequestDispatcher rd = request.getRequestDispatcher("adminlist.jsp");
		try {
			rd.forward(request, response);
		} catch (ServletException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
	}

}
